/////////////////////////////////////////////////////////////////////////////
// Name:        LGear_Diag.cpp
// Purpose:     Manager of the Landing Gear
// Author:      Matthew Gong
// Created:     07/25/2005
// Copyright:   (c) Matthew Gong
// Licence:     GPL licence
/////////////////////////////////////////////////////////////////////////////

#ifdef __GNUG__
// #pragma implementation
#endif

// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

// -*- C++ -*- generated by wxGlade 0.4cvs on Mon Jul 25 09:33:27 2005

#include <wx/datetime.h>

#include "LGear_Diag.h"
#include "MyApp.h"

ClientData_LGear::ClientData_LGear()
  : type(wxT("BOGEY")),
    x(0),y(0),z(0),
    loc_unit(wxT("M")),
    spring_coeff(0),
    spring_coeff_unit(wxT("N/M")),
    damping_coeff(0),
    damping_coeff_unit(wxT("N/M/SEC")),
    static_friction(0),
    dynamic_friction(0),
    rolling_friction(0),
    max_steer(0),
    max_steer_unit(wxT("DEG")),
    brake_group(wxT("NONE")),
    retractable(true)
{
  name = wxString::Format(wxT("LGear%lu"), wxDateTime::Now().GetTicks());
}

void ClientData_LGear::Load(JSBSim::Element * el)
{
  name = std2wxstr(el->GetAttributeValue("name"));
  if (name.IsEmpty())
    name = wxT("Unknown");
  
  type = std2wxstr(el->GetAttributeValue("type"));
  if (type.IsEmpty())
    type = wxT("BOGEY");

  JSBSim::Element * temp_element;

  if (temp_element = el->FindElement("location"))
  {
    loc_unit = std2wxstr(temp_element->GetAttributeValue("unit"));
    if (loc_unit.IsEmpty())
      loc_unit = wxT("IN");
    x = temp_element->FindElementValueAsNumber("x");
    y = temp_element->FindElementValueAsNumber("y");
    z = temp_element->FindElementValueAsNumber("z");
  }
  
  if (temp_element = el->FindElement("static_friction"))
  {
    static_friction = temp_element->GetDataAsNumber();
  }
  
  if (temp_element = el->FindElement("dynamic_friction"))
  {
    dynamic_friction = temp_element->GetDataAsNumber();
  }
  
  if (temp_element = el->FindElement("rolling_friction"))
  {
    rolling_friction = temp_element->GetDataAsNumber();
  }
  
  if (temp_element = el->FindElement("spring_coeff"))
  {
    spring_coeff_unit = std2wxstr(temp_element->GetAttributeValue("unit"));
    spring_coeff = temp_element->GetDataAsNumber();
  }

  if (temp_element = el->FindElement("damping_coeff"))
  {
    damping_coeff_unit = std2wxstr(temp_element->GetAttributeValue("unit"));
    damping_coeff = temp_element->GetDataAsNumber();
  }

  if (temp_element = el->FindElement("max_steer"))
  {
    max_steer_unit = std2wxstr(temp_element->GetAttributeValue("unit"));
    max_steer = temp_element->GetDataAsNumber();
  }

  if (temp_element = el->FindElement("brake_group"))
  {
    brake_group = std2wxstr(temp_element->GetDataLine());
    size_t s,e;
    size_t len = brake_group.Length();
    s = 0;
    while (brake_group[s] == ' ' && s < len) ++s;
    e = s;
    while (brake_group[e] != ' ' && e < len) ++e;
    brake_group = brake_group.Mid(s, e-s);
  }

  if (temp_element = el->FindElement("retractable"))
  {
    retractable = ((((int)temp_element->GetDataAsNumber()) == 0) ? false : true);
  }

}

void ClientData_LGear::Save(wxTextOutputStream & out, const wxString & prefix)
{
  out << prefix << wxT("<contact type=\"") << type << wxT("\" name=\"") << name << wxT("\">\n");
  wxString pre = prefix + wxT("    ");
  out << pre << wxT("<location unit=\"") << loc_unit << wxT("\">\n");
  out << pre << wxT("    <x> ") << wxString::Format(wxT("%g"), x) << wxT(" </x>\n");
  out << pre << wxT("    <y> ") << wxString::Format(wxT("%g"), y) << wxT(" </y>\n");
  out << pre << wxT("    <z> ") << wxString::Format(wxT("%g"), z) << wxT(" </z>\n");
  out << pre << wxT("</location>\n");
  out << pre << wxT("<static_friction> ") << wxString::Format(wxT("%g"), static_friction) << wxT(" </static_friction>\n");
  out << pre << wxT("<dynamic_friction> ") << wxString::Format(wxT("%g"), dynamic_friction) << wxT(" </dynamic_friction>\n");
  out << pre << wxT("<rolling_friction> ") << wxString::Format(wxT("%g"), rolling_friction) << wxT(" </rolling_friction>\n");
  out << pre << wxT("<spring_coeff unit=\"") << spring_coeff_unit << wxT("\"> ") << wxString::Format(wxT("%g"), spring_coeff) << wxT(" </spring_coeff>\n");
  out << pre << wxT("<damping_coeff unit=\"") << damping_coeff_unit << wxT("\"> ") << wxString::Format(wxT("%g"), damping_coeff) << wxT(" </damping_coeff>\n");
  out << pre << wxT("<max_steer unit=\"") << max_steer_unit << wxT("\"> ") << wxString::Format(wxT("%g"), max_steer) << wxT(" </max_steer>\n");
  out << pre << wxT("<brake_group> ") << brake_group << wxT(" </brake_group>\n");
  out << pre << wxT("<retractable> ") << (retractable ? 1 : 0) << wxT(" </retractable>\n");
  out << prefix << wxT("</contact>\n");
}

wxString ClientData_LGear::GetText() const
{
  return name + wxT(" at ") + wxString::Format(wxT("point [%g, %g, %g]"), x, y, z) +  wxT(" in ") + loc_unit + wxT(" (in ") + brake_group + wxT(" brake group)");
}

void ClientData_LGear::ShowDialog()
{
  LGearDialog dlg(NULL, -1 );
  dlg.Load(this);
  if (dlg.ShowModal() == wxID_OK)
  {
    dlg.Save(this);
  }
}



LGearDialog::LGearDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
    wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE)
{
    // begin wxGlade: LGearDialog::LGearDialog
    sizer_4_staticbox = new wxStaticBox(this, -1, _("Location"));
    label_name = new wxStaticText(this, -1, _("Name"));
    text_ctrl_name = new wxTextCtrl(this, -1, wxT(""));
    label_type = new wxStaticText(this, -1, _("Type"));
    text_ctrl_type = new wxTextCtrl(this, -1, wxT("BOGEY"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
    label_x = new wxStaticText(this, -1, _("x ="));
    text_ctrl_x = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    label_y = new wxStaticText(this, -1, _("y ="));
    text_ctrl_y = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    label_z = new wxStaticText(this, -1, _("z ="));
    text_ctrl_z = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    const wxString combo_box_unit_choices[] = {
        wxT("M"),
        wxT("IN"),
        wxT("FT")
    };
    combo_box_unit = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 3, combo_box_unit_choices, wxCB_DROPDOWN|wxCB_READONLY);
    label_spring = new wxStaticText(this, -1, _("spring coefficient ="), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
    text_ctrl_spring = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    const wxString combo_box_spring_choices[] = {
        wxT("N/M"),
        wxT("LBS/FT")
    };
    combo_box_spring = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 2, combo_box_spring_choices, wxCB_DROPDOWN|wxCB_READONLY);
    label_damping = new wxStaticText(this, -1, _("damping coefficient ="), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
    text_ctrl_damping = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    const wxString combo_box_damping_choices[] = {
        wxT("N/M/SEC"),
        wxT("LBS/FT/SEC")
    };
    combo_box_damping = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 2, combo_box_damping_choices, wxCB_DROPDOWN|wxCB_SIMPLE|wxCB_READONLY);
    label_static_friction = new wxStaticText(this, -1, _("static friction ="), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
    text_ctrl_static_friction = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    label_dynamic_friction = new wxStaticText(this, -1, _("dynamic friction ="), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
    text_ctrl_dynamic_friction = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    label_rolling_friction = new wxStaticText(this, -1, _("rolling friction ="), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
    text_ctrl_rolling_friction = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    label_max_steer = new wxStaticText(this, -1, _("max stear ="), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
    text_ctrl_max_steer = new wxTextCtrl(this, -1, wxT("0"), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
    const wxString combo_box_max_steer_choices[] = {
        wxT("DEG")
    };
    combo_box_max_steer = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 1, combo_box_max_steer_choices, wxCB_DROPDOWN|wxCB_SIMPLE|wxCB_READONLY);
    label_brake_group = new wxStaticText(this, -1, _("brake_group ="), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
    const wxString combo_box_brake_group_choices[] = {
        wxT("LEFT"),
        wxT("RIGHT"),
        wxT("CENTER"),
        wxT("NOSE"),
        wxT("TAIL"),
        wxT("NONE")
    };
    combo_box_brake_group = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 6, combo_box_brake_group_choices, wxCB_DROPDOWN|wxCB_SIMPLE|wxCB_READONLY);
    label_retractable = new wxStaticText(this, -1, _("retractable"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
    checkbox_retractable = new wxCheckBox(this, -1, wxT(""));
    button_ok = new wxButton(this, wxID_OK, _("OK"));
    button_cancel = new wxButton(this, wxID_CANCEL, _("Cancel"));

    set_properties();
    do_layout();
    // end wxGlade
}


void LGearDialog::set_properties()
{
    // begin wxGlade: LGearDialog::set_properties
    combo_box_unit->SetMinSize(wxSize(60, -1));
    combo_box_unit->SetSelection(0);
    label_spring->SetMinSize(wxSize(200, -1));
    combo_box_spring->SetMinSize(wxSize(80, -1));
    combo_box_spring->SetSelection(0);
    label_damping->SetMinSize(wxSize(200, -1));
    combo_box_damping->SetMinSize(wxSize(110, -1));
    combo_box_damping->SetSelection(0);
    label_static_friction->SetMinSize(wxSize(200, -1));
    label_dynamic_friction->SetMinSize(wxSize(200, -1));
    label_rolling_friction->SetMinSize(wxSize(200, -1));
    label_max_steer->SetMinSize(wxSize(200, -1));
    combo_box_max_steer->SetMinSize(wxSize(80, -1));
    combo_box_max_steer->SetSelection(0);
    label_brake_group->SetMinSize(wxSize(200, -1));
    combo_box_brake_group->SetSelection(0);
    label_retractable->SetMinSize(wxSize(200, -1));
    checkbox_retractable->SetValue(1);
    button_cancel->SetDefault();
    // end wxGlade
}


void LGearDialog::do_layout()
{
    // begin wxGlade: LGearDialog::do_layout
    wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer* sizer_2 = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer* sizer_5_copy_2_copy_2_copy = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer* sizer_5_copy_2_copy_2 = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer* sizer_5_copy_1 = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer* sizer_5_copy_2_copy_1 = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer* sizer_5_copy_2_copy = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer* sizer_5_copy_2 = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer* sizer_5_copy = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer* sizer_5 = new wxBoxSizer(wxHORIZONTAL);
    wxStaticBoxSizer* sizer_4 = new wxStaticBoxSizer(sizer_4_staticbox, wxHORIZONTAL);
    wxBoxSizer* sizer_3 = new wxBoxSizer(wxHORIZONTAL);
    sizer_3->Add(label_name, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5);
    sizer_3->Add(text_ctrl_name, 1, wxRIGHT|wxADJUST_MINSIZE, 5);
    sizer_3->Add(label_type, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_3->Add(text_ctrl_type, 1, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5);
    sizer_1->Add(sizer_3, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_4->Add(label_x, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_4->Add(text_ctrl_x, 1, wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_4->Add(label_y, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_4->Add(text_ctrl_y, 1, wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_4->Add(label_z, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_4->Add(text_ctrl_z, 1, wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_4->Add(combo_box_unit, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_4, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_5->Add(label_spring, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5->Add(text_ctrl_spring, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5->Add(combo_box_spring, 0, wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_5, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_5_copy->Add(label_damping, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy->Add(text_ctrl_damping, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy->Add(combo_box_damping, 0, wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_5_copy, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_5_copy_2->Add(label_static_friction, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy_2->Add(text_ctrl_static_friction, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_5_copy_2, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_5_copy_2_copy->Add(label_dynamic_friction, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy_2_copy->Add(text_ctrl_dynamic_friction, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_5_copy_2_copy, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_5_copy_2_copy_1->Add(label_rolling_friction, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy_2_copy_1->Add(text_ctrl_rolling_friction, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_5_copy_2_copy_1, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_5_copy_1->Add(label_max_steer, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy_1->Add(text_ctrl_max_steer, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy_1->Add(combo_box_max_steer, 0, wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_5_copy_1, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_5_copy_2_copy_2->Add(label_brake_group, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy_2_copy_2->Add(combo_box_brake_group, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_5_copy_2_copy_2, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_5_copy_2_copy_2_copy->Add(label_retractable, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_5_copy_2_copy_2_copy->Add(checkbox_retractable, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5);
    sizer_1->Add(sizer_5_copy_2_copy_2_copy, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
    sizer_2->Add(button_ok, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 20);
    sizer_2->Add(button_cancel, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 20);
    sizer_1->Add(sizer_2, 0, wxEXPAND, 0);
    SetAutoLayout(true);
    SetSizer(sizer_1);
    sizer_1->Fit(this);
    sizer_1->SetSizeHints(this);
    Layout();
    // end wxGlade
}


void LGearDialog::Load(const ClientData_LGear * data)
{
  text_ctrl_name->SetValue(data->name);
  text_ctrl_type->SetValue(data->type);
  text_ctrl_x->SetValue(wxString::Format(wxT("%g"), data->x));
  text_ctrl_y->SetValue(wxString::Format(wxT("%g"), data->y));
  text_ctrl_z->SetValue(wxString::Format(wxT("%g"), data->z));
  combo_box_unit->SetValue(data->loc_unit);
  text_ctrl_spring->SetValue(wxString::Format(wxT("%g"), data->spring_coeff));
  combo_box_spring->SetValue(data->spring_coeff_unit);
  text_ctrl_damping->SetValue(wxString::Format(wxT("%g"), data->damping_coeff));
  combo_box_damping->SetValue(data->damping_coeff_unit);
  text_ctrl_static_friction->SetValue(wxString::Format(wxT("%g"), data->static_friction));
  text_ctrl_dynamic_friction->SetValue(wxString::Format(wxT("%g"), data->dynamic_friction));
  text_ctrl_rolling_friction->SetValue(wxString::Format(wxT("%g"), data->rolling_friction));
  text_ctrl_max_steer->SetValue(wxString::Format(wxT("%g"), data->max_steer));
  combo_box_max_steer->SetValue(data->max_steer_unit);
  combo_box_brake_group->SetValue(data->brake_group);
  checkbox_retractable->SetValue(data->retractable);
}

void LGearDialog::Save(ClientData_LGear * data)
{
    data->name = text_ctrl_name->GetValue();
    data->type = text_ctrl_type->GetValue();
    double tmp;
    if (text_ctrl_x->GetValue().ToDouble(&tmp))
    {
      data->x = tmp;
    }
    if (text_ctrl_y->GetValue().ToDouble(&tmp))
    {
      data->y = tmp;
    }
    if (text_ctrl_z->GetValue().ToDouble(&tmp))
    {
      data->z = tmp;
    }
    data->loc_unit = combo_box_unit->GetValue();
    if (text_ctrl_spring->GetValue().ToDouble(&tmp))
    {
      data->spring_coeff = tmp;
    }
    data->spring_coeff_unit = combo_box_spring->GetValue();
    if (text_ctrl_damping->GetValue().ToDouble(&tmp))
    {
      data->damping_coeff = tmp;
    }
    data->damping_coeff_unit = combo_box_damping->GetValue();
    if (text_ctrl_static_friction->GetValue().ToDouble(&tmp))
    {
      data->static_friction = tmp;
    }
    if (text_ctrl_dynamic_friction->GetValue().ToDouble(&tmp))
    {
      data->dynamic_friction = tmp;
    }
    if (text_ctrl_rolling_friction->GetValue().ToDouble(&tmp))
    {
      data->rolling_friction = tmp;
    }
    if (text_ctrl_max_steer->GetValue().ToDouble(&tmp))
    {
      data->max_steer = tmp;
    }
    data->max_steer_unit = combo_box_max_steer->GetValue();
    data->brake_group = combo_box_brake_group->GetValue();
    data->retractable = checkbox_retractable->GetValue();
}


